package com.qiaofang.applet.service.other.domain;

import com.qiaofang.applet.common.base.BaseDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import java.util.*;

/**
 * Created by IDEA.
 *
 * @author QF2019
 * @auther Zym.
 * @company qiaofang
 * @date 2020/9/10 17:21
 */
@Data
@Builder
@Document(collection = "other_corporation")
@ApiModel("集团表")
@NoArgsConstructor
@AllArgsConstructor
public class Corporation extends BaseDomain {

    @NotNull(message = "集团名称不能为空")
    @ApiModelProperty("集团名称")
    private String corporationName;

    @ApiModelProperty("拉取数据appId")
    private String pullAppId;

    @ApiModelProperty("拉取数据appKey")
    private String pullAppKey;

    @ApiModelProperty("拉取数据的域名")
    private String pullDomain;

    @ApiModelProperty("上下架处理的域名")
    private String processingDomain;

    @ApiModelProperty("官网域名")
    private String webDomain;

    @ApiModelProperty("授权方appId")
    private String authAppId;

    @ApiModelProperty("授权方appSecret")
    private String authAppSecret;

    @ApiModelProperty("授权方用户名")
    private String authUsername;

    @ApiModelProperty("管理员授权状态(获取授权中:0 |已授权:1 |逾期未授权:2)")
    private Integer authStatus;

    @ApiModelProperty("提交授权时间（定时任务用）")
    private Date submitAuthTime;

    @ApiModelProperty("授权方token")
    private String authAccessToken;

    @ApiModelProperty("授权方刷新token")
    private String authRefreshToken;

    @ApiModelProperty("授权方token生成时间（定时任务用）")
    private String tokenCreateTime;

    @ApiModelProperty("流程状态(0提交审核成功、1业务域名设置失败、2提交代码失败、3提交审核失败、4审核通过、5审核失败、6发布成功、7发布失败）")
    private Integer processStatus;

    @ApiModelProperty("失败原因")
    private String processFailReason;

    @ApiModelProperty("提交审核版本")
    private String commitVersion;

    @ApiModelProperty("提交审核时间（定时任务用）")
    private Date commitTime;

    @ApiModelProperty("小程序审核id")
    private Integer auditId;

    @ApiModelProperty("已审核版本")
    private String auditVersion;

    @ApiModelProperty("上次发布版本（回退时用）")
    private String lastReleasedVersion;

    @ApiModelProperty("发布版本")
    private String releasedVersion;

    @ApiModelProperty("发布时间")
    private Date releasedTime;

    @ApiModelProperty("短信平台配置")
    private List<SmsPlatformConfig> smsPlatformConfig;

    @ApiModelProperty("IM账号前缀")
    private String accidPrefix;

    @ApiModelProperty("导航栏标题")
    private String navigationBarTitle;

    @ApiModelProperty("小程序名称")
    private String miniName;

    @ApiModelProperty("首页Logo(小程序)")
    private String homeLogo;

    @ApiModelProperty("logo(小程序)")
    private String logo;

    @ApiModelProperty("PC官网图标")
    private String pcWebImg;

    @ApiModelProperty("PC官网LOGO")
    private String pcWebLogo;

    @ApiModelProperty("备案信息")
    private String archivalInfo;

    @ApiModelProperty("ICP备案号")
    private String archivalNo;

    @ApiModelProperty("ICP备案号跳转地址")
    private String archivalNoUrl;

    @ApiModelProperty("二维码")
    private String qrCode;

    @ApiModelProperty("删除标识,true表示删除，false 表示未删除")
    private Boolean deleted;

    @ApiModelProperty("开关配置")
    private SwitchConfig switchConfig;

    @ApiModelProperty("二手房上下架规则")
    private PropertyRules propertyRules;

    @ApiModelProperty("新房上下架规则")
    private FirsthandRules firsthandRules;

    @ApiModelProperty("V10Url地址")
    private String v10Url;

    @ApiModelProperty("集团隐私协议(小程序)")
    private String privacyAgreement;

    @ApiModelProperty("集团隐私协议(官网)")
    private String PCprivacyAgreement;

    @ApiModelProperty("PC官网大标题")
    private String pcWebBigTile;

    @ApiModelProperty("PC官网小标题")
    private String pcWebLittleTile;

    @ApiModelProperty("访客提醒服务通知模板id")
    private String templateId;

    @ApiModelProperty("商学院跳转链接")
    private String jumpUrl;

    @ApiModelProperty("商学院菜单名称")
    private String menuName;

    @ApiModelProperty("商学院小程序APPid")
    private String commerceAppId;

    @ApiModelProperty("自动回复配置")
    private String employeeReplyParams;

    @ApiModelProperty("公安备案号")
    private String safetyArchivalNo;

    @ApiModelProperty("公安备案号跳转地址")
    private String safetyArchivalNoUrl;

    @ApiModelProperty("经纪人标签列表")
    private List<EmployeeLabel> employeeLabelList;

    @ApiModelProperty("官网标题")
    private String title;

    @ApiModelProperty("官网关键词")
    private String keywords;

    @ApiModelProperty("官网说明")
    private String description;

    @ApiModelProperty("搜索引擎收录配置,key：SearchEngineKeyEnum")
    private BaiduSearchEngine baiduSearchEngine;

    @ApiModelProperty("是否对接20")
    private Boolean v20Flag;

    @ApiModelProperty("公众号appid")
    private String oaAppId;

    @ApiModelProperty("公众号AppSecret")
    private String oaAppSecret;

    @ApiModelProperty("公众号引导关注url")
    private String officialAccountUrl;

    public PropertyRules getPropertyRules() {
        if (propertyRules == null){
            propertyRules = new PropertyRules();
            propertyRules.setHousePhoto(true);
            propertyRules.setHousePhotoNum(5);
        }
        if (propertyRules.getPrivyList() == null){
            propertyRules.setPrivyList(new LinkedList<>());
        }
        return propertyRules;
    }

    public FirsthandRules getFirsthandRules() {
        if (firsthandRules == null){
            firsthandRules = new FirsthandRules();
            firsthandRules.setHousePhoto(true);
            firsthandRules.setHousePhotoNum(5);
        }
        return firsthandRules;
    }

    public List<EmployeeLabel> getEmployeeLabelList() {
        if (employeeLabelList == null){
            return new ArrayList<>();
        }
        return employeeLabelList;
    }
}
